<template>
  <div>
    <ViewPage :page="page" @report="report" />
  </div>
</template>
<script lang="ts">
  import { Page, Button } from '@magein/vue-page';
  export default {
    setup() {
      const order_status = {
        '1': '代付款',
        '2': '已付款',
      };
      let page = new Page();
      page.name='user';
      page.search = ['name', 'phone', ['status', order_status], 'region'];
      page.form = [
        'name',
        'password',
        'sex',
        'age',
        'status',
        'start_time',
        'end_time',
        'begion_end',
        'region',
        'avatar',
        'address|ta',
      ];
      page.table = [
        'id',
        'name',
        'avatar',
        'phone',
        'sex',
        'age|edit',
        'status|switch',
        'email',
        'address',
        'created_at',
        'operation|action|180',
      ];
      page.table.action = ['edit', 'remove'];
      page.table.dropAction = [new Button('group', '授权分组', 'mdi:ev-plug-chademo')];
      const report = (params) => {
        let key=params?.key;
        let callback=params?.callback;
        if (key === 'group') {
          console.log('授权分组', params);
        }else if(typeof callback==="function"){
          callback();
        }
      };
      return {
        page,
        report,
      };
    },
  };
</script>
